-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[Clang] Remap paths in OpenMP runtime calls (#82541) #141250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@llvm/pr-subscribers-clang @llvm/pr-subscribers-clang-codegen Author: Dan McGregor (dankm) ChangesApply the debug prefix mapping to the OpenMP location strings. Fixes #82541 Full diff: https://github.com/llvm/llvm-project/pull/141250.diff 1 Files Affected:
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index e458d437d085a..196c28071bfd6 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -1352,7 +1352,12 @@ static StringRef getIdentStringFromSourceLocation(CodeGenFunction &CGF,
llvm::raw_svector_ostream OS(Buffer);
// Build debug location
PresumedLoc PLoc = CGF.getContext().getSourceManager().getPresumedLoc(Loc);
- OS << ";" << PLoc.getFilename() << ";";
+ OS << ";";
+ if (CGF.getDebugInfo())
+ OS << CGF.getDebugInfo()->remapDIPath(PLoc.getFilename());
+ else
+ OS << PLoc.getFilename();
+ OS << ";";
if (const auto *FD = dyn_cast_or_null<FunctionDecl>(CGF.CurFuncDecl))
OS << FD->getQualifiedNameAsString();
OS << ";" << PLoc.getLine() << ";" << PLoc.getColumn() << ";;";
@@ -1370,10 +1375,14 @@ llvm::Value *CGOpenMPRuntime::emitUpdateLocation(CodeGenFunction &CGF,
SrcLocStr = OMPBuilder.getOrCreateDefaultSrcLocStr(SrcLocStrSize);
} else {
std::string FunctionName;
+ std::string FileName;
if (const auto *FD = dyn_cast_or_null<FunctionDecl>(CGF.CurFuncDecl))
FunctionName = FD->getQualifiedNameAsString();
PresumedLoc PLoc = CGF.getContext().getSourceManager().getPresumedLoc(Loc);
- const char *FileName = PLoc.getFilename();
+ if (CGF.getDebugInfo())
+ FileName = CGF.getDebugInfo()->remapDIPath(PLoc.getFilename());
+ else
+ FileName = PLoc.getFilename();
unsigned Line = PLoc.getLine();
unsigned Column = PLoc.getColumn();
SrcLocStr = OMPBuilder.getOrCreateSrcLocStr(FunctionName, FileName, Line,
@@ -8840,8 +8849,13 @@ emitMappingInformation(CodeGenFunction &CGF, llvm::OpenMPIRBuilder &OMPBuilder,
ExprName = MapExprs.getMapDecl()->getNameAsString();
}
+ std::string FileName;
PresumedLoc PLoc = CGF.getContext().getSourceManager().getPresumedLoc(Loc);
- return OMPBuilder.getOrCreateSrcLocStr(PLoc.getFilename(), ExprName,
+ if (CGF.getDebugInfo())
+ FileName = CGF.getDebugInfo()->remapDIPath(PLoc.getFilename());
+ else
+ FileName = PLoc.getFilename();
+ return OMPBuilder.getOrCreateSrcLocStr(FileName, ExprName,
PLoc.getLine(), PLoc.getColumn(),
SrcLocStrSize);
}
|
|
I do need to add tests for this, but wanted to get the general idea up for comments. |
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
7fdc69f to
b8f8274
Compare
Latest update includes basic tests as well. |
|
@jdoerfert it looks like you wrote the original code I'm modifying here, so I'd like your feedback. Don't know who else would be interested here. |
|
Neat, the original was good, and apparently some tests don't run on my system. Going back to to that version :/ |
Apply the debug prefix mapping to the OpenMP location strings. Fixes llvm#82541
Hm, @alexey-bataev looks like this is arguably conformance related too. |
|
If people are good with this, I don't have commit access, so I'd appreciate somebody merging. |
|
Thank you, @alexey-bataev for your review and your merge! |
Apply the debug prefix mapping to the OpenMP location strings.
Fixes #82541